package com.armedia.remote.client.desktop;

import com.armedia.remote.client.MediaServiceAsync;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HTML;

public class DesktopPanel extends DockLayoutPanel {
	private final MediaServiceAsync mediaService;

	public DesktopPanel(final MediaServiceAsync mediaService) {
		super(Unit.EM);
		this.mediaService = mediaService;
		
		addNorth(new HTML("Header"), 2);
		
		addWest(new Button("PL", new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				mediaService.play(new AsyncCallback<Void>() {
					@Override
					public void onSuccess(Void result) {
					}
					
					@Override
					public void onFailure(Throwable caught) {
					}
				});
			}
		}), 5);
		addWest(new Button("NE", new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				mediaService.next(new AsyncCallback<Void>() {
					@Override
					public void onSuccess(Void result) {
					}
					
					@Override
					public void onFailure(Throwable caught) {
					}
				});
			}
		}), 7);
		addWest(new Button("PR", new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				mediaService.prev(new AsyncCallback<Void>() {
					@Override
					public void onSuccess(Void result) {
					}
					
					@Override
					public void onFailure(Throwable caught) {
					}
				});
			}
		}), 9);
	}

}
